/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sun.hunk.util;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.collections.Factory;
import org.apache.commons.collections.ListUtils;

/**
 *
 * @author sunil
 */
public class ListUtil {

    public static List lazyList(final Class c) {
        Factory factory = new Factory() {
            public Object create(){
                try {
//                    return Class.forName(c.getClass().getName());
                    return c.newInstance();
                } catch (InstantiationException ex) {
                    Logger.getLogger(ListUtil.class.getName()).log(Level.SEVERE, null, ex);
                } catch (IllegalAccessException ex) {
                    Logger.getLogger(ListUtil.class.getName()).log(Level.SEVERE, null, ex);
                }
                return null;

            }
        };
        return ListUtils.lazyList(new ArrayList(), factory);
    }
}
